﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System;
using System.Data;
using System.Web;
using Telerik.Web.UI;

namespace KPIS.GERP.GHRMS.APP.App_UI.Forms
{
    public partial class Upload : System.Web.UI.Page
    {
         protected void Page_Load(object sender, EventArgs e)
         {
             if (!Page.IsPostBack)
             {
                 RadTreeList1.ExpandToLevel(1);
                 RadTreeList1.EditIndexes.Add(new TreeListHierarchyIndex { NestedLevel = 0, LevelIndex = 0 });
                 RadTreeList1.ExpandToLevel(1);
             }
         }

         protected void RadTreeList1_NeedDataSource(object sender, TreeListNeedDataSourceEventArgs e)
         {
             RadTreeList1.DataSource = MyData.GetData();
         }
    }
    public class MyData
    {
        public static List<MyItem> GetData()
        {
            List<MyItem> list = new List<MyItem>();
            list.Add(new MyItem("A", "Appetizers", "", null, null, true, ""));
            list.Add(new MyItem("B", "Beverages", "", null, null, true, ""));
            list.Add(new MyItem("C", "Cheese", "", null, null, false, ""));
            list.Add(new MyItem("A1", "Southwestern Twisted Chips", "150 gr.", 6.79, 1.22, false, "A"));
            list.Add(new MyItem("A2", "Top Shelf Combo Appetizer", "300 gr.", 9.49, 2.56, true, "A"));
            list.Add(new MyItem("B1", "Sangria", "90 ml.", 6.49, 1.34, true, "B"));
            list.Add(new MyItem("B2", "Margarita", "60 ml.", 7.39, 1.89, false, "B"));
            list.Add(new MyItem("B3", "Red Cherry Boost", "200 ml.", 6.99, 1.53, false, "B"));
            list.Add(new MyItem("B4", "Mojito", "180 ml.", 7.59, 2.03, true, "B"));
            list.Add(new MyItem("C1", "Blue Cheese and Hazelnut Shortbread", "220 gr.", 10.69, 3.15, false, "C"));
            list.Add(new MyItem("C2", "Avocado Feta Salsa", "240 gr.", 7.19, 1.96, false, "C"));
            return list;
        }
    }
    public class MyItem
    {
        public string ID { get; set; }
        public string ProductName { get; set; }
        public string Quantity { get; set; }
        public double? Price { get; set; }
        public double? Discount { get; set; }
        public bool InStock { get; set; }
        public string ParentID { get; set; }
        public MyItem(string id, string productName, string quantity, double? price, double? discount, bool inStock, string parentID)
        {
            ID = id;
            ProductName = productName;
            Quantity = quantity;
            Price = price;
            Discount = discount;
            InStock = inStock;
            ParentID = parentID;

        }
    }
}